package web

import (
	"encoding/json"
	"github.com/gin-gonic/gin"
)

// ParserRequestData 解析请求数据
func ParserRequestData[T any](c *gin.Context, t *T) error {
	data, err := c.GetRawData()
	if err != nil {
		return err
	}
	err = json.Unmarshal(data, t)
	if err != nil {
		return err
	}
	return nil
}
